import instance from '../../modules/axios.ts';

export function Login(params: any) {
    return instance.post(
        "/login",
        params,
    );
}

export function Register(params: any) {
    return instance.post(
        "/register",
        params,
    );
}

export function ChangePassword(id: string | number, params: any) {
    return instance.patch(
        `/users/${id}/password`,
        params,
    );
}

export function GetAdminInfo(params: any) {
    return instance.get(
        "/admin_info",
        {params: params},
    );
}

export function GetUsers(params: any) {
    return instance.get(
        '/users',
        {params: params},
    );
}

export function GetUser(params: any) {
    return instance.get(
        '/users/' + params.id,
    );
}

export function UpdateUser(params: any) {
    return instance.put(
        '/users/' + params.id,
        params,
    );
}

export function DeleteUser(params: any) {
    return instance.delete(
        '/users/' + params.id,
    );
}

export function GetUserRoles(params: any) {
    return instance.get(
        '/users/' + params.id + "/roles",
        {params: params},
    );
}

export function UpdateUserRoles(params: any) {
    return instance.post(
        '/users/' + params.id + "/roles",
        params,
    );
}